<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<style>
    /*重新设置样式*/
    .form-control {
        width: 196px !important;
        height: 34px !important;
        padding: 10px !important;
    }
    .control-label{
        padding: 0px !important;
    }
</style>
<body class="hold-transition skin-blue sidebar-mini"  onload="checkBrowser()">
<section class="content-header">
    <h1 style="display: inline-block" th:if="${totalPrice==null}">串料执行</h1>
    <h1 style="display: inline-block" th:if="${totalPrice!=null}" th:text="${month}+'月串料金额:'"></h1>
    <h1 style="display: inline-block" th:if="${totalPrice!=null}" th:text="${totalPrice}"></h1>
    <h1 style="display: inline-block" th:if="${totalPrice!=null}">万元</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        单据编号
                                    </label>
                                    <input name="ceoCode" type="text" class="form-control text" maxlength="50"
                                           placeholder="请输入单据编号"/>

                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        需求项目编号
                                    </label>
                                    <input name="ceoNeedProCode" type="text" class="form-control text"
                                           placeholder="请输入项目编号"/>

                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        需求项目名称
                                    </label>

                                    <input name="ceoNeedProName" type="text" class="form-control text" maxlength="255"
                                           placeholder="请输入项目名称"/>

                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        需求物料描述
                                    </label>
                                    <label class="control-label">
                                        <input name="ceoNeedMatName" type="text" class="form-control text"
                                               maxlength="255"
                                               placeholder="请输入需求物料描述"/>
                                    </label>
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        挪用项目编号
                                    </label>
                                    <input name="ceoUseProCode" type="text" class="form-control text"
                                           placeholder="请输入项目编号"/>

                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        挪用项目名称
                                    </label>

                                    <input name="ceoUseProName" type="text" class="form-control text" maxlength="255"
                                           placeholder="请输入项目名称"/>

                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        挪用物料描述
                                    </label>
                                    <label class="control-label">
                                        <input name="ceoUseMatName" type="text" class="form-control text"
                                               maxlength="255"
                                               placeholder="请输入需求物料描述"/>
                                    </label>
                                </div>

                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        申请人
                                    </label>

                                    <input name="ceoAppPerson" type="text" class="form-control text" maxlength="255"
                                           placeholder="请输入申请者信息"/>

                                </div>

                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        串料申请单状态
                                    </label>

                                    <select th:if="${mode}==null" name="ceoAppyStatusSelect"  class="selectpicker" multiple
                                            style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width: 100px!important;">
                                        <!--<option value="0">全部</option>-->
                                        <option value="2" selected="selected">未执行</option>
                                        <option value="3">已执行</option>
                                        <option value="5">已出库</option>
                                    </select>
                                    <input th:if="${mode}==null" value="2" type="hidden" style="display: none" name="ceoAppyStatusStr">
                                    <select th:if="${mode}!=null" name="ceoAppyStatusSelect"  class="selectpicker" multiple
                                            style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width: 100px!important;">
                                        <option value="0">全部</option>
                                        <option value="2" >未执行</option>
                                        <option value="3" selected="selected">已执行</option>
                                        <option value="5" selected="selected">已出库</option>
                                    </select>
                                    <input th:if="${mode}!=null" value="3,5" type="hidden" style="display: none" name="ceoAppyStatusStr">
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        仓库
                                    </label>
                                    <label class="control-label">
                                        <select name="whiId" class="selectpicker"
                                                multiple data-actions-box="true"
                                                style="padding: 0px!important;text-align: center!important;text-align-last: center!important;">
                                            <option selected th:each="item:${warehouseInfoList}"
                                                    th:value="${item.whiId}"
                                                    th:text="${item.whiName}"></option>
                                        </select>
                                        <input th:value="${whiIds}" type="hidden" style="display: none" name="whiIds">
                                    </label>
                                    <input name="ceoAppyStatusText" type="hidden" style="display: none" value="1,4"/>
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        使用单位
                                    </label>

                                    <select name="ceoNeedDepId" class="form-control select"
                                            style="padding: 0px!important;text-align: center!important;text-align-last: center!important;">
                                    </select>

                                </div>
                                <!--<div class="form-group" style="margin-right: 10px;margin-bottom: 5px">-->
                                    <!--<label class="control-label" style="text-align: right">-->
                                        <!--使用单位-->
                                    <!--</label>-->
                                    <!--<input name="ceoAppPerson" type="text" class="form-control text" maxlength="255"-->
                                           <!--placeholder="请输入单位信息"/>-->
                                <!--</div>-->
                                <div class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="width:85px;text-align: right">
                                        申请日期范围
                                    </label>
                                    <input  name="beginDate" type="text"
                                           class="form-control datepicker" style="width: 100px!important;"
                                           readonly="readonly"> -
                                    <input  name="endDate" type="text"
                                            class="form-control datepicker" style="width: 100px!important;"
                                            readonly="readonly">
                                </div>
                                <div class="form-group" style=" margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="width:85px;text-align: right">
                                        执行日期范围
                                    </label>
                                    <input  name="execBeginDate" type="text"
                                            class="form-control datepicker" style="width: 100px!important;"
                                            readonly="readonly"> -
                                    <input  name="execEndDate" type="text"
                                            class="form-control datepicker" style="width: 100px!important;"
                                            readonly="readonly">
                                </div>
                                <div id="submitDate" class="form-group" style="margin-right: 10px;margin-bottom: 5px">
                                    <label class="control-label" style="text-align: right">
                                        提交日期范围
                                    </label>
                                    <label class="control-label">
                                        <input name="beginSubmitDate" type="text" class="form-control datepicker"
                                               style="width:100px!important;text-align: center!important;"
                                               readonly="readonly"/>-
                                        <input name="endSubmitDate" type="text" class="form-control datepicker"
                                               style="width:100px!important;text-align: center!important;"
                                               readonly="readonly"/>
                                    </label>
                                </div>
                                <div class="form-group" style=" margin-top:15px;margin-right: 10px;margin-bottom: 5px">
                                    <button type="button" class="btn btn-success" id="btn-search">搜索
                                    </button>
                                </div>
                            </div>
                        </div>

                    </form>
                </div>
                <div id="toolbar">
                    <button shiro:hasPermission="purinv:purexeccha:edit" type="button" class="btn btn-success"
                            onclick="execApply(this,'')">
                        批量执行
                    </button>
                    <button shiro:hasPermission="purinv:purexeccha:edit"
                            type="button"
                            class="btn btn-danger"
                            style="margin-left: 10px;"
                            onclick="rejectApply(this,'')">
                        批量驳回
                    </button>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table" class="table table-bordered " width="100%">
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>

<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var table;
    var ceoApplyStatusText = ["", "未提交", "未执行", "已执行", "被驳回", "已出库"];
    var ceoApplyStatusColor = ["", " bg-gray", " bg-gray", " bg-green", " bg-red", " bg-green"];
    var mode = [[${mode}]];


    function checkBrowserFun() {
        let is360 = false;
        let isIE = false;
        let isFirefox = false;
        let isChrome = false;
        let isEdge = false;
        let broName = 'Runing';
        let str = '';
        let strStart = 0;
        let strStop = 0;
        let arr = new Array();
        let temp = '';
        let userAgent = window.navigator.userAgent; //包含以下属性中所有或一部分的字符串：appCodeName,appName,appVersion,language,platform
        /*alert(userAgent);*/
        //FireFox
        if (userAgent.indexOf('Firefox') != -1) {
            isFireFox = true;
            /*broName = 'FireFox浏览器';*/
            strStart = userAgent.indexOf('Firefox');
            temp = userAgent.substring(strStart);
            broName = temp.replace('/', '版本号')

        }
        //Edge
        if (userAgent.indexOf('Edge') != -1) {
            isEdge = true;
            /*broName = 'Edge浏览器';*/
            strStart = userAgent.indexOf('Edge');
            temp = userAgent.substring(strStart);
            broName = temp.replace('/', '版本号');
        }
        //IE浏览器
        if (userAgent.indexOf('NET') != -1 && userAgent.indexOf("rv") != -1) {
            isIE = true;
            /*broName = 'IE浏览器'; */
            strStart = userAgent.indexOf('rv');
            strStop = userAgent.indexOf(')');
            temp = userAgent.substring(strStart, strStop);
            broName = temp.replace('rv', 'IE').replace(':', '版本号');
        }
        //360极速模式可以区分360安全浏览器和360极速浏览器
        if (userAgent.indexOf('WOW') != -1 && userAgent.indexOf("NET") < 0 && userAgent.indexOf("Firefox") < 0) {
            if (navigator.javaEnabled()) {
                is360 = true;
                broName = '360安全浏览器-极速模式';
            } else {
                is360 = true;
                broName = '360极速浏览器-极速模式';
            }
        }
        //360兼容
        if (userAgent.indexOf('WOW') != -1 && userAgent.indexOf("NET") != -1 && userAgent.indexOf("MSIE") != -1 && userAgent.indexOf("rv") < 0) {
            is360 = true;
            broName = '360兼容模式';
        }
        //Chrome浏览器
        if (userAgent.indexOf('WOW') < 0 && userAgent.indexOf('Chrome') > 0 && userAgent.indexOf("Edg") < 0) {
            isChrome = true;
            /*broName = 'Chrome浏览器';*/
            strStart = userAgent.indexOf('Chrome');
            strStop = userAgent.indexOf(' Safari');
            temp = userAgent.substring(strStart, strStop);
            broName = temp.replace('/', '版本号');
        }
        return isChrome;
    }

    /**
     * 检测浏览器
     * */
    function checkBrowser(){
        if(!checkBrowserFun()){
            js.modal.warning("尊敬的客户，您使用浏览器不是谷歌浏览器，请使用谷歌浏览器访问本系统！");
            location.href=ctx+"overview/index";
        }
    }

    /**
     * 初始化配置
     * */
    function initConfig() {
        if(mode!=null){
            $("#queryForm").hide();
            $("#toolbar").hide();
            $("#execBeginDate").val([[${start}]]);
            $("#execEndDate").val([[${end}]]);
            $("#execBeginDate").datepicker('setDate', [[${start}]]);
            $("#execEndDate").datepicker('setDate', [[${end}]]);
        }else {
            $("#queryForm").show();
            $("#toolbar").show();
        }
    }
    /**
     * 撤销
     * */
    function revokeAppy(ceoIds) {
        bootbox.confirm("您确认要撤销此标记吗？", function (result) {
            if (result) {
                $("#toolbar").hide();
                $("#bootstrap-table").hide();
                $.post(ctx + 'purchase/change/revokeAppy', {
                    ceoIds: ceoIds
                }, function (result) {
                    if (result.type == "SUCCESS") {
                        js.table.refresh(table);
                        $("#toolbar").show();
                        $("#bootstrap-table").show();
                    } else if (result.type == "ERROR") {
                        js.modal.fail(result.msg);
                        js.table.refresh(table);
                        $("#toolbar").show();
                        $("#bootstrap-table").show();
                    }
                }, 'json');
            }else {
                $("#toolbar").show();
                $("#bootstrap-table").show();
            }
        });
        // js.modal.confirm("您确认要撤销此标记吗？", function () {
        //     $("#toolbar").hide();
        //     $("#bootstrap-table").hide();
        //     $.post(ctx + 'purchase/change/revokeAppy', {
        //         ceoIds: ceoIds
        //     }, function (result) {
        //         if (result.type == "SUCCESS") {
        //             js.table.refresh(table);
        //             $("#toolbar").show();
        //             $("#bootstrap-table").show();
        //         } else if (result.type == "ERROR") {
        //             js.modal.fail(result.msg);
        //             js.table.refresh(table);
        //             $("#toolbar").show();
        //             $("#bootstrap-table").show();
        //         }
        //     }, 'json');
        // });
    }


    /**
     *@FunctionName: execApply
     *@Description: 执行
     *@Author: 徐一贺
     *@CreateDate: 2020/4/21 12:35
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function execApply(obj,ceoIds) {
        bootbox.confirm("您确认要执行此标记吗？", function (result) {
            if (result) {
                $("#toolbar").hide();
                $("#bootstrap-table").hide();
                if (ceoIds == '') {
                    $('input[name="cb_change"]').each(function () {
                        if (!$(this).prop("disabled")) {
                            if ($(this).prop("checked")) {
                                ceoIds += $(this).attr("data") + ",";
                            }
                        }
                    })
                    ceoIds = ceoIds.substring(0, ceoIds.length - 1);
                }
                if (ceoIds == '') {
                    js.modal.warning("请选择要执行的串料申请！");
                    return;
                }
                $(obj).hide();
                $.post(ctx + 'purchase/change/execApply', {
                    ceoIds: ceoIds
                }, function (result) {
                    if (result.type == web_status.SUCCESS) {
                        js.table.refresh(table);
                        js.modal.success(result.msg);
                        $("#toolbar").show();
                        $("#bootstrap-table").show();
                    } else {
                        js.table.refresh(table);
                        js.modal.warning(result.msg);
                        $("#toolbar").show();
                        $("#bootstrap-table").show();
                    }
                    $(obj).show();
                }, 'json');
            }else {
                $("#toolbar").show();
                $("#bootstrap-table").show();
            }
        });
    }

    /**
     *@FunctionName: rejectApply
     *@Description: 驳回
     *@Author: 徐一贺
     *@CreateDate: 2020/4/21 13:09
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function rejectApply(obj,ceoIds) {
        bootbox.confirm("您确认要驳回此串料申请吗？", function (result) {
            if (result) {
                $("#toolbar").hide();
                $("#bootstrap-table").hide();
                if (ceoIds == '') {
                    $('input[name="cb_change"]').each(function () {
                        if (!$(this).prop("disabled")) {
                            if ($(this).prop("checked")) {
                                ceoIds += $(this).attr("data") + ",";
                            }
                        }
                    })
                    ceoIds = ceoIds.substring(0, ceoIds.length - 1);
                }
                if (ceoIds == '') {
                    js.modal.warning("请选择要驳回的串料申请！");
                    return;
                }
                $.post(ctx + 'purchase/change/reject', {
                    ceoIds: ceoIds
                }, function (result) {
                    if (result.type == "SUCCESS") {
                        js.modal.success(result.msg);
                        $("#selectAll").prop('checked', false);
                        $("#toolbar").show();
                        $("#bootstrap-table").show();
                    }else {
                        js.modal.warning(result.msg);
                        $("#toolbar").show();
                        $("#bootstrap-table").show();
                    }
                    js.table.refresh(table);
                }, 'json');
            }else {
                $("#toolbar").show();
                $("#bootstrap-table").show();
            }
        });
    }


    /**
     *@FunctionName: search
     *@Description: 查询
     *@Author: 徐一贺
     *@CreateDate: 2020/4/10 16:10
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function search() {
        js.table.search(table);
    }

    /**
     *@FunctionName: selectAll
     *@Description: 全选
     *@Author: 徐一贺
     *@CreateDate: 2020/4/8 15:20
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function selectAll(obj) {
        $('input[name="cb_change"]').each(function () {
            if (!$(this).prop("disabled")) {
                if ($(obj).prop("checked")) {
                    $(this).prop("checked", true);
                }
                if ($(obj).prop("checked") == false) {
                    $(this).prop("checked", false);
                }
            }
        })

    }

    /**
     *@FunctionName: loadDept
     *@Description: 加载使用单位
     *@Author: 徐一贺
     *@CreateDate: 2020/4/21 10:06
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function loadDept() {
        $.post(ctx + 'purchase/change/deptList', {}, function (result) {
            if (result.type == "SUCCESS") {
                $("#queryForm [name='ceoNeedDepId']").empty();
                $("#queryForm [name='ceoNeedDepId']").append('<option value="">全部</option>');
                for (var i = 0; i < result.data.length; i++) {
                    $("#queryForm [name='ceoNeedDepId']").append('<option value="' + result.data[i].depId + '">' + result.data[i].depName + '</option>');
                }
            }
        }, 'json');
    }


    $(function () {
        $("title").html($("title").html()+" —— 串料执行");
        loadDept();
        initConfig();
        let columnArr = new Array();
        if(mode!=null){
            columnArr =  [
                {
                    title: '序号', field: 'ceoId', width: '50',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: '单据编号', field: 'ceoCode', width: '150'},
                {title: '需求<br>项目号', field: 'ceoNeedProCode', formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }},
                {title: '需求<br>项目名称', field: 'ceoNeedProName', width: '100', formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }},
                {title: '需求<br>物料描述', field: 'ceoNeedMatName', width: '100'},
                {title: '需求<br>数量', field: 'ceoNeedNum'},
                {title: '使用部门', field: 'ceoNeedDepName'},
                {
                    title: '挪用<br>项目编号', field: 'ceoUseProCode'
                    , formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }
                },
                {
                    title: '挪用<br>项目名称', field: 'ceoUseProName', width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }
                },
                {
                    title: '挪用<br>物料描述', field: 'ceoUseMatName', width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '仓库', field: 'whiName', width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '申请日期', field: 'ceoAppDate',width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '申请人', field: 'ceoAppPerson',width:'70'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '提交时间', field: 'ceoSubmitDate', width: '90'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return "<div style='width: 80px'>" + value + "</div>";
                    }
                },
            ];
        }else{
            columnArr =  [
                {
                    title: '<input title="全选" style="width: 16px;height: 16px" id="selectAll" onclick="selectAll(this)" type="checkbox" />',
                    width: '30',
                    field: 'ceoId',
                    formatter: function (value, row, index) {
                        var disabled = 'disabled="disabled"';
                        if (row.ceoAppyStatus != undefined && row.ceoAppyStatus != null) {
                            disabled = "";
                        }
                        return '<input style="width: 16px;height: 16px" ' + disabled + ' id="cb_change' + row.ceoId + '" name="cb_change" data="' + row.ceoId + '"  type="checkbox" />';
                    }
                },
                {
                    title: '序号', field: 'ceoId', width: '50',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: '单据编号', field: 'ceoCode', width: '150'},
                {title: '需求<br>项目号', field: 'ceoNeedProCode', formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }},
                {title: '需求<br>项目名称', field: 'ceoNeedProName', width: '100', formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }},
                {title: '需求<br>物料描述', field: 'ceoNeedMatName', width: '100'},
                {title: '需求<br>数量', field: 'ceoNeedNum'},
                {title: '使用部门', field: 'ceoNeedDepName'},
                {
                    title: '挪用<br>项目编号', field: 'ceoUseProCode'
                    , formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }
                },
                {
                    title: '挪用<br>项目名称', field: 'ceoUseProName', width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = "--";
                        }
                        return value;
                    }
                },
                {
                    title: '挪用<br>物料描述', field: 'ceoUseMatName', width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '仓库', field: 'whiName', width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '申请日期', field: 'ceoAppDate',width: '100'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '申请人', field: 'ceoAppPerson',width:'70'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return value;
                    }
                },
                {
                    title: '提交时间', field: 'ceoSubmitDate', width: '90'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        return "<div style='width: 80px'>" + value + "</div>";
                    }
                },
                {
                    title: '状态', field: 'ceoAppyStatus',width: '70'
                    , formatter: function (value, row, index) {
                        if (value == undefined) {
                            return "";
                        }
                        var html='<label class="badge '+ceoApplyStatusColor[value]+'">'+ceoApplyStatusText[value]+'</label>';
                        return html;
                    }
                },
                {
                    title: '操作', field: 'ceoId',width: '235',
                    formatter: function (value, row, index) {
                        var htmlText = "";
                        if (row.ceoAppyStatus == 3) {
                            if (hasP('purinv:purexeccha:edit')) {
                                htmlText += '<button class="btn btn-primary btn-xs" onclick="revokeAppy(' + row.ceoId + ')">撤销</button>';
                            }
                            return htmlText
                        }
                        if (row.ceoAppyStatus == 2) {
                            if (hasP('purinv:purexeccha:view')) {
                                htmlText += '<button class="btn btn-info btn-xs" style="margin-right:5px"  onclick="seePanel(' + row.ceoId + ')">查看</button>';
                            }
                            if (hasP('purinv:purexeccha:edit')) {
                                htmlText += '<button style="margin-right:5px" class="btn btn-success btn-xs" onclick="execApply(this,' + row.ceoId + ')">执行</button>';
                                htmlText += '<button style="margin-right:5px" onclick="rejectApply(this,' + row.ceoId + ')" class="btn btn-xs btn-danger">驳回</button>';
                            }
                        }
                        return htmlText;
                    }
                }
            ];
        }


        //加载列表数据
        table = js.table.init({
            id: 'bootstrap-table',
            url: ctx + "purchase/change/execList",
            showColumns: true,
            showExport: false,
            pageSize: 300,
            striped: false,
            uniqueId: "rppId",
            // rowStyle: function (row, index) {
            //     if (row.ceoAppyStatus != undefined && row.ceoAppyStatus != 3) {
            //         return {css: {"background-color": "#C7EDCC"}}
            //     } else {
            //         return {css: {"background-color": "#ffffff"}}
            //     }
            // },
            onLoadSuccess: function () {
                $('#bootstrap-table thead th').each(function () {
                    $(this).width(Math.floor($(this).width()));
                });
                $('#bootstrap-table tbody tr:first td').each(function () {
                    $(this).width(Math.floor($(this).width()));
                });
            },
            columns:columnArr
        });
        /**
         * 表格搜索
         */
        $("#btn-search").on('click', function () {
            js.table.search(table);
        });
        $("#queryForm [name='whiId']").change(function () {
            $("#queryForm input[name='whiIds']").val($("#queryForm [name='whiId']").val());
        });

        $("#queryForm [name='ceoAppyStatusSelect']").change(function () {
            $("#queryForm input[name='ceoAppyStatusStr']").val($("#queryForm [name='ceoAppyStatusSelect']").val());
        });
    });

    /**
     *@FunctionName: seePanel
     *@Description: 查看
     *@Author: 徐一贺
     *@CreateDate: 2020/4/24 12:48
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function seePanel(ceoId) {
        location.href = "/purchase/change/createPage/see/" + ceoId;
    }
</script>
</body>
</html>
